<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="平方" onclick="a()">
<input type="button" value="求和" onclick="f1()">
<input id="i1" type="text">
<div>结果:</div>
<script>
  let i=document.querySelector("#i1");
  let d=document.querySelector("div");
  function a(){
    if(isNaN(i.value)){
      d.innerText="sb";
      return;
  }
    d.innerText=i.value*i.value;
  }
  function f1(){
    //d.innerText="和的结果"+(i.value*1+i.value*1);
    d.innerText="和的结果:"+(parseFloat(i.value)+parseFloat(i.value));
  }
</script>
</body>
</html>